package com.gzcstec.stmp.controller;

import com.gzcstec.stmp.service.MailSender;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

@RestController
@RequestMapping("/mail")
public class MailController {

    @Autowired
    private MailSender mailSender;

    @RequestMapping("/send")
    public String send() {
        String to = "1053361201@qq.com";
        String subject = "丛师微信统一认证平台";
        Map paras = new HashMap<>();
        try {
            paras.put("returnURL" , "http://benke.gzcstec.net/wechat/checkUser.mvc");
            paras.put("state" , "202b901b189a4a019a81f25e667b939c");
            mailSender.sendMail4Template(new String[]{to} , subject , "mail.ftl" , paras , "d:/gzcstec_wechat.pdf");
        } catch (Exception e) {
            e.printStackTrace();
        }
        return "success";
    }
}
